﻿using Autofac;
using MahApps.Metro.Controls;
using PLC.Interface.BaseUsers;
using PLCWpfTest.Common;
using PLCWpfTest.ViewModels;
using YWM;

namespace PLCWpfTest.Views
{
    /// <summary>
    /// UserOperationWindow.xaml 的交互逻辑
    /// </summary>
    public partial class UserOperationWindow : MetroWindow
    {
        public UserOperationWindow(BaseUserDto baseUser)
        {
            InitializeComponent();
            UserOperationViewModel userOperationViewModel = YApp.Resolve<UserOperationViewModel>(new NamedParameter(Constant.DTO_BASE_USER, baseUser));
            userOperationViewModel.RequestClose += userOperationViewModel_RequestClose;
            DataContext = userOperationViewModel;
        }

        private void userOperationViewModel_RequestClose()
        {
            DialogResult = true;
            Close();
        }
    }
}
